<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<p>首页</p>
<div></div>
<script>
    console.log(location.search);// ?uname=andy
    //1.去掉 ? substr('起始的位置',截取几个字符);
    var params = location.search.substr(1);//uname=andy;
    console.log(params);
    //2.利用=把字符串分割为数组 split('=')
    var arr = params.split('=');
    console.log(arr);//["uname", "asd"]
    var div = document.querySelector('div');
    //3.把数据写入div中
    div.innerHTML = arr[1] + '欢迎你';
</script>
</body>
</html>